home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7231 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  28 lines

  1. Newsgroups: comp.lang.c
  2. Path: cwi.nl!dik
  3. From: dik@cwi.nl (Dik T. Winter)
  4. Subject: Re: Tough FACTORIAL math problem...
  5. Message-ID: <DMy8EM.DCA@cwi.nl>
  6. Sender: news@cwi.nl (The Daily Dross)
  7. Nntp-Posting-Host: chrysant.cwi.nl
  8. Organization: CWI, Amsterdam
  9. References: <31224679.6193@born.com> <4fv16m$cuj@winx03.informatik.uni-wuerzburg.de> <4g339u$dkk@news.microsoft.com>
  10. Date: Sun, 18 Feb 1996 02:03:57 GMT
  11.  
  12. In article <4g339u$dkk@news.microsoft.com> a-cnadc@microsoft.com (Dann Corbit) writes:
  13.  > Jochen's program is almost there, but it will fail 
  14.  > when the factor produces two zeros.  Here is one 
  15.  > that will do the job.  The number "100000L" has to
  16.  > be chosen carefully, so that it will not overflow
  17.  > when multiplied by the next factor, and so that it
  18.  > will not truncated needed digits of precision.  It 
  19.  > must be larger than n and smaller than MAX_LONG/n:
  20.  
  21. Being larger than n is no guarantee.  100,000 fails for n = 9375 or larger.
  22. Actually when 5^n <= n < 5^(n+1) you need 10^(n+1) to be sure (although
  23. smaller values might work).  9375 = 3*5^5, so you need 1,000,000 in that
  24. case to be sure (and that is the smallest number for which it is required).
  25. -- 
  26. dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland, +31205924098
  27. home: bovenover 215, 1025 jn  amsterdam, nederland; http://www.cwi.nl/~dik/
  28.